using System.Collections.Generic;
using UnityEngine;

namespace DL.Tools
{
    //特效全局管理 
    //调整播放速度
    public class VFXManager : Singleton<VFXManager>
    {
        [SerializeField]private List<ParticleSystem> m_ParticleSystems;
        [SerializeField, Header("特效播放倍率")] private float SpeedMult;
        protected override void Construct()
        {
            base.Construct();
            m_ParticleSystems = new();
        }
        
        public void AddParticleSystem(ParticleSystem ps) => m_ParticleSystems.Add(ps);

        
        public void SetVFXSpeed(float speedMult)
        {
            foreach (var particleSystem in m_ParticleSystems)
            {
                var main = particleSystem.main;
                main.simulationSpeed = speedMult;
            }
        }
        
        public void ResetVXF()
        {
            foreach (var particleSystem in m_ParticleSystems)
            {
                var main = particleSystem.main;
                main.simulationSpeed = SpeedMult;
            }
           
        }
        
        public void PauseVFX()
        {
            SetVFXSpeed(0);
        }
        
        
        
    }
}
